import sys
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton

def func_shoot():
    print("按钮按下啦，发射火箭！")

# ----------------------------------------------------
def init_Widget(w:QWidget):
    w.setWindowTitle("按钮")
    w.resize(640,480)    

    btu = QPushButton("发射")
    btu.setText("发射火箭")
    
    btu.clicked.connect(func_shoot)
    
    btu.setParent(w)
    
if __name__ == '__main__':
    # 1. 创建应用程序
    app = QApplication(sys.argv)
    # 2. 创建窗口
    w = QWidget()
    init_Widget(w)
    # 3. 显示窗口
    w.show()
    # 4. 等待窗口停止
    sys.exit(app.exec())
    